package kr.snake75.command;

import java.lang.reflect.Method;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MultiCommand implements Command {

	@Override
	public CommandResult execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
 
		String methodName = request.getParameter("method");
		Class<?> clz = this.getClass();
		Method targetMethod = clz.getDeclaredMethod(methodName, HttpServletRequest.class, HttpServletResponse.class);

		return (CommandResult)targetMethod.invoke(this, request, response);
	}

}
